package src.IO;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.SequenceInputStream;

public class Merge {

    public static void testSequeceInputStream() throws IOException {
        FileInputStream fis1=new FileInputStream("e:\\a.txt");
        FileInputStream fis2=new FileInputStream("e:\\b.txt");
        FileInputStream fis3=new FileInputStream("e:\\d.txt");
        FileInputStream fis4=new FileInputStream("e:\\e.txt");
        SequenceInputStream s1=new SequenceInputStream(fis1,fis2);
        SequenceInputStream s2=new SequenceInputStream(fis3,fis4);
        int len=0;
        byte[] byt=new byte[1024];
        FileOutputStream fos=new FileOutputStream("e:\\c.txt");
        while ((len=s1.read(byt))!=-1){
            fos.write(byt,0,len);
        }
        s1.close();
    }

}
class MergeTester{
    public static void main(String[] args) throws IOException {
        Merge.testSequeceInputStream();
    }
}
